import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RepairVO, RepairForm, RepairQuery } from '@/api/system/repair/types';

/**
 * 查询设备检维修列表
 * @param query
 * @returns {*}
 */

export const listRepair = (query?: RepairQuery): AxiosPromise<RepairVO[]> => {
  return request({
    url: '/system/repair/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备检维修详细
 * @param id
 */
export const getRepair = (id: string | number): AxiosPromise<RepairVO> => {
  return request({
    url: '/system/repair/' + id,
    method: 'get'
  });
};

/**
 * 新增设备检维修
 * @param data
 */
export const addRepair = (data: RepairForm) => {
  return request({
    url: '/system/repair',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备检维修
 * @param data
 */
export const updateRepair = (data: RepairForm) => {
  return request({
    url: '/system/repair',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备检维修
 * @param id
 */
export const delRepair = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/repair/' + id,
    method: 'delete'
  });
};
